#include "widget.h"
#include "ui_widget.h"
#include <QHBoxLayout>
#include <QSpacerItem>
#include <QPushButton>



Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QHBoxLayout* layout = new QHBoxLayout;

    QPushButton* b1 = new QPushButton;
    QPushButton* b2 = new QPushButton;
    QSpacerItem* space = new QSpacerItem(100,100);

    b1->setText("按钮1");
    b2->setText("按钮2");

//    // 加入空白
//    layout->addSpacerItem(space);
//    layout->addWidget(b1);
//    layout->addWidget(b2);


//    layout->addWidget(b1);
//    // 加入空白
//    layout->addSpacerItem(space);
//    layout->addWidget(b2);



    layout->addWidget(b1);
    layout->addWidget(b2);
    // 加入空白
    layout->addSpacerItem(space);



    this->setLayout(layout);


}

Widget::~Widget()
{
    delete ui;
}

